package com.tywj.panda.customer.common.entity

import android.os.Parcel
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import com.tywj.lib.businessweak.entity.AbsPagingEntity

/**
 * @desc 订单记录数据
 * @author June Yang
 * @date 2019/12/11
 */
class TravelEntity : AbsPagingEntity<TravelEntity.DataBean>() {

    class DataBean() : Parcelable {

        //客户端新接口，方便控制日期显示
        var lineTravelDate = ""

        //行程列表中的数据
        var listTravel = ArrayList<DataBean>()

        /**********以上新增字段，方便处理时间和列表*************/

        @SerializedName("line_code")
        var lineCode = ""

        @SerializedName("line_date")
        var lineDate = ""

        /**
         * 发车时间
         */
        @SerializedName("line_time")
        var lineTime = ""

        @SerializedName("line_name")
        var lineName = ""

        /**
         * 票价
         */
        var price = 0

        /**
         * 上车地点
         */
        @SerializedName("geton_loc")
        var startStation = ""

        /**
         * 下车地点
         */
        @SerializedName("getoff_loc")
        var endStation = ""

        /**
         * 预计上车时间
         */
        @SerializedName("geton_time")
        var onTime = ""

        /**
         * 预计下车时间
         */
        @SerializedName("getoff_time")
        var offTime = ""

        /**
         * 城市名称
         */
        @SerializedName("city_name")
        var cityName = ""

        /**
         * 商品编号
         */
        @SerializedName("goods_no")
        var goodsNo = ""

        @SerializedName("vehicle_no")
        var vehicleNo = ""


        //车票编号
        @SerializedName("ticket_code")
        var ticketCode = ""

        /**
         * 车票张数
         */
        var number = 0

        /**
         * 退票张数
         */
        @SerializedName("refund_number")
        var refundNumber = 0

        /**
         * 退款金额 （退票中新增）
         */
        var refundFee = 0

        /**
         * 手续费 （退票中新增）
         */
        var chargeService = 0

        /**
         * 已使用数量
         */
        var userNumber = 0

        /**
         * 车票状态
         */
        var status = 0

        /**
         * 派车的状态
         */
        var vehicleStatus = 0

        constructor(parcel: Parcel) : this() {

            lineTravelDate = parcel.readString() ?: ""
            lineCode = parcel.readString() ?: ""
            lineDate = parcel.readString() ?: ""
            lineTime = parcel.readString() ?: ""
            lineName = parcel.readString() ?: ""
            price = parcel.readInt()
            startStation = parcel.readString() ?: ""
            endStation = parcel.readString() ?: ""
            onTime = parcel.readString() ?: ""
            offTime = parcel.readString() ?: ""
            cityName = parcel.readString() ?: ""
            goodsNo = parcel.readString() ?: ""
            vehicleNo = parcel.readString() ?: ""
            ticketCode = parcel.readString() ?: ""
            number = parcel.readInt()
            refundNumber = parcel.readInt()
            refundFee = parcel.readInt()
            chargeService = parcel.readInt()
            status = parcel.readInt()
            vehicleStatus = parcel.readInt()
        }


        override fun writeToParcel(dest: Parcel, flags: Int) {
            dest.writeString(lineTravelDate)
            dest.writeString(lineCode)
            dest.writeString(lineDate)
            dest.writeString(lineTime)
            dest.writeString(lineName)
            dest.writeInt(price)
            dest.writeString(startStation)
            dest.writeString(endStation)
            dest.writeString(onTime)
            dest.writeString(offTime)
            dest.writeString(cityName)
            dest.writeString(goodsNo)
            dest.writeString(vehicleNo)
            dest.writeString(ticketCode)
            dest.writeInt(number)
            dest.writeInt(refundNumber)
            dest.writeInt(refundFee)
            dest.writeInt(chargeService)
            dest.writeInt(status)
            dest.writeInt(vehicleStatus)
        }

        override fun describeContents(): Int = 0


        companion object CREATOR : Parcelable.Creator<DataBean> {
            override fun createFromParcel(parcel: Parcel): DataBean {
                return DataBean(parcel)
            }

            override fun newArray(size: Int): Array<DataBean?> {
                return arrayOfNulls(size)
            }
        }

        override fun toString(): String {
            return "DataBean(lineTravelDate='$lineTravelDate', listTravel=$listTravel, lineDate='$lineDate', lineTime='$lineTime', lineName='$lineName', startStation='$startStation', endStation='$endStation', onTime='$onTime', offTime='$offTime', cityCode='$cityName', goodsNo='$goodsNo', vehicleNo='$vehicleNo', ticketCode='$ticketCode', number=$number, refundNumber=$refundNumber, userNumber=$userNumber, status=$status, vehicleStatus=$vehicleStatus)"
        }
    }
}
